#include "queue.h"
#include <vector>
#include <queue>
//void test_priority_queue()
//{
//	priority_queue<int, vector<int>, greater<int>> pq;
//	pq.push(1);
//	pq.push(8);
//	pq.push(6);
//	pq.push(2);
//	pq.push(0);
//	pq.push(7);
//	pq.push(4);
//
//	while (!pq.empty())
//	{
//		cout << pq.top() << " ";
//		pq.pop();
//	}
//	cout << endl;
//}
//
//template <class T>
//struct Less
//{
//	bool operator()(const T& x, const T& y)
//	{
//		return x < y;
//	}
//};

//void test1()
//{
//	Less<int> lessFunc;
//	cout << lessFunc(1, 2) << endl;
//}

class Date
{
public:
	Date(int year = 1900, int month = 1, int day = 1)
		: _year(year)
		, _month(month)
		, _day(day)
	{}
	bool operator<(const Date& d)const
	{
		return (_year < d._year) ||
			(_year == d._year && _month < d._month) ||
			(_year == d._year && _month == d._month && _day < d._day);
	}
	bool operator>(const Date& d)const
	{
		return (_year > d._year) ||
			(_year == d._year && _month > d._month) ||
			(_year == d._year && _month == d._month && _day > d._day);
	}
	friend ostream& operator<<(ostream& _cout, const Date& d)
	{
		_cout << d._year << "-" << d._month << "-" << d._day;
		return _cout;
	}
private:
	int _year;
	int _month;
	int _day;
};

class PDataLess
{
public:
	bool operator()(const Date* p1, const Date* p2)
	{
		return *p1 < *p2;
	}
};

class PDataGreater
{
public:
	bool operator()(const Date* p1, const Date* p2)
	{
		return *p1 > *p2;
	}
};

void TestPriorityQueue()
{
	priority_queue<Date*, vector<Date*>, PDataGreater> q;
	q.push(new Date(2023, 4, 8));
	q.push(new Date(2023, 4, 9));
	q.push(new Date(2023, 4, 7));
	cout << *(q.top()) << endl;
}


int main()
{
	//test_priority_queue();
	//test1();

	//bin::test1();
	TestPriorityQueue();

	return 0;
}